package com.itheima.task;

import java.util.Scanner;

public class Task3 {
    public static void main(String[] args) {
        double sum = 0;//sum表示本息总额
        Scanner sc = new Scanner(System.in);
        System.out.println("请输入存入金额");
        double money = sc.nextInt();
        while (money < 1000) {
            System.out.println("输入的金额不和法，请重新输入存入金额");
            money = sc.nextInt();
        }

        boolean flag = true;
        while (flag) {
            System.out.println("请输入存期的年份");
            int year = sc.nextInt();
            switch (year) {
                case 1 -> {
                    System.out.println(sum = money + money * 0.0225);
                    flag = false;
                }
                case 2 -> {
                    System.out.println(sum = money + money * 2 * 0.027);
                    flag = false;
                }

                case 3 -> {
                    System.out.println(sum = money + money * 3 * 0.0325);
                    flag = false;
                }
                case 5 -> {
                    System.out.println(sum = money + money * 5 * 0.036);
                    flag = false;
                }
                default -> {
                    System.out.println("输入的年份不合法，请重新输入");
                }
            }
        }

    }
}
